package cn.hahah.module.blog.dal.mysql.visithistorybrowse;

import java.util.*;

import cn.hahah.framework.common.pojo.PageResult;
import cn.hahah.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.hahah.framework.mybatis.core.mapper.BaseMapperX;
import cn.hahah.module.blog.dal.dataobject.visithistorybrowse.VisitHistoryBrowseDO;
import org.apache.ibatis.annotations.Mapper;
import cn.hahah.module.blog.controller.admin.visithistorybrowse.vo.*;

/**
 * 游客文章浏览记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface VisitHistoryBrowseMapper extends BaseMapperX<VisitHistoryBrowseDO> {

    default PageResult<VisitHistoryBrowseDO> selectPage(VisitHistoryBrowsePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VisitHistoryBrowseDO>()
                .eqIfPresent(VisitHistoryBrowseDO::getVisit, reqVO.getVisit())
                .eqIfPresent(VisitHistoryBrowseDO::getArticleId, reqVO.getArticleId())
                .betweenIfPresent(VisitHistoryBrowseDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VisitHistoryBrowseDO::getId));
    }

}